package com.qzxy.premiumhotelsystem.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzxy.premiumhotelsystem.domain.dto.VipDTO;
import com.qzxy.premiumhotelsystem.domain.dto.VipPageDTO;
import com.qzxy.premiumhotelsystem.domain.entity.Vip;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qzxy.premiumhotelsystem.domain.vo.VipEmailVO;
import com.qzxy.premiumhotelsystem.domain.vo.VipVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
* @author 14912
* @description 针对表【vip】的数据库操作Mapper
* @createDate 2024-09-12 15:55:14
* @Entity com.qzxy.premiumhotelsystem.domain.pojo.Vip
*/
@Mapper
public interface VipMapper extends BaseMapper<Vip> {

    List<Vip> findActiveVips();

    int deleteExpiredVips(Date oneMonthAgo);

    List<VipVO> getVipsAndType(Integer guestId);

    List<Vip> selectExpiredVips(Date oneMonthAgo);

    IPage<VipVO> pageQueryVipWithVipType(IPage<VipVO> page, @Param("dto") VipPageDTO vipPageDTO);

    VipVO selectVipVo(Integer guestId, Integer vipTypeId);

    List<VipEmailVO> findVipsExpiringSoon();

    /**
     * 会员管理所需
     * @return
     */
    @Select("select * from vip " +
            "left join vip_types " +
            "on vip.vip_type_id = vip_types.vip_type_id " +
            "left join guests " +
            "on guests.guest_id = vip.guest_id ")
    List<VipDTO> allVip();




}




